/*
 * @Author: TJN tjn@246@126.com
 * @Date: 2024-06-20 15:15:32
 * @LastEditors: TJN tjn@246@126.com
 * @LastEditTime: 2024-06-21 09:58:05
 * @FilePath: \hdcms-nest\prisma\seed.ts
 * @Description:
 *
 * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
 */

import { PrismaClient } from '@prisma/client';
import { Random } from 'mockjs';

const prisma = new PrismaClient();

async function run() {
  for (let i = 0; i <= 20; i++) {
    await prisma.user.create({
      data: {
        name: Random.cname(),
        email: Random.email(),
        password: Random.string(),
        App: {
          create: {
            title: Random.csentence(),
            content: Random.cparagraph(),
            preview: Random.image(),
          },
        },
      },
    });
  }

  const user = await prisma.user.update({
    where: {
      id: 1,
    },
    data: {
      name: 'admin',
      password: 'admin123',
    },
  });
}

run();
